<!DOCTYPE html>
<html class="x-admin-sm">

<head>
    <meta charset="UTF-8">
    <title>欢迎页面-X-admin2.1</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" href="/xadmin/css/font.css">
    <link rel="stylesheet" href="/xadmin/css/xadmin.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script type="text/javascript" src="/xadmin/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="/xadmin/js/xadmin.js"></script>
    <script type="text/javascript" src="/xadmin/js/cookie.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<link rel="stylesheet" href="/xadmin/lib/layui/css/modules/laydate/default/laydate.css">
<script src="/js/jquery-1.8.3.js"></script>
<input type="hidden" name="_token" id='token' value="{{csrf_token()}}"/>
<body>
<div class="x-body">

                <span class="x-red">*</span>房间号

                <input type="text" id="room_id" name="room_id">
                 <br /><br />

                <span class="x-red">*</span>客户名称
                <input type="text" id="user_id" name="user_id">
                <br /><br />

                <span class="x-red">*</span>销售代表

                <input type="text" id="sale_id" name="sale_id">
                <br /><br />




                <span class="x-red">*</span>详情

                <textarea rows="5" cols="50" name="details" id="details"></textarea>
                 <br /><br />



                <span class="x-red">*</span>时间


                <input type="text" id="time" name="time">
                 <br /><br />





                <span class="x-red">*</span>状态
                <input type="text" id="status" name="status"><br /><br />





                <span class="x-red">*</span>看房次数
                <input type="text" id="number" name="number">
                <br /><br />







            <button  class="layui-btn"  id="submit" onclick="addjou()">
                增加
            </button>


</div>
<script>
    /*layui.use(['form','layer'], function(){
        $ = layui.jquery;
        var form = layui.form
            ,layer = layui.layer;





    });*/

    //监听提交
    function addjou() {


        var room_id = $('#room_id').val();
        var user_id = $('#user_id').val();
        var sale_id = $('#sale_id').val();
        var details = $('#details').val();
        var time = $('#time').val();
        var status = $('#status').val();
        var number = $('#number').val();
        var token = $('#token').val();
        console.log(room_id);
        console.log(user_id);
        console.log(sale_id);
        console.log(details);
        console.log(time);
        console.log(status);
        console.log(number);

        var data = new FormData();
            data.append('room_id', room_id);
            data.append('user_id', user_id);
            data.append('sale_id', sale_id);
            data.append('details', details);
            data.append('time', time);
            data.append('status', status);
            data.append('number', number);
            data.append('_token', token);

            $.ajax({
                type: 'post',
                url: "{{url('admin/add_journal')}}",
                data: data,
                cache: false,
                processData: false,
                contentType: false,

                success: function (msg) {
                    alert(msg);
               if (msg == 1){
                        alert('添加OK');
                        parent.location.reload();
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index);//关闭弹出层
                    } else {
                        alert('添加失败');
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index);//关闭弹出层
                    }
                }
            });


    }
</script>
{{--<script>
    var _hmt = _hmt || []; (function() {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
    })();
</script>--}}
</body>

</html>